#

#共通参数
include         ../apmmodule/Makefile_comm.mk

CFLAGS = -fPIC -DFRDBG_PRINT_SEND
ifdef DEFINE_NO_SEND
CFLAGS += -DFRDBG_NO_ZMQ_SEND
endif

CFLAGS          += $(CFLAGS_EXT) `xml2-config --cflags`
CFLAGS          += $(CFLAGS_UTEST)

#-DFRDBG_FAST_SEND              不做缓存队列，直接发送
#-DFRDBG_NO_ZMQ_SEND            不需要zmq_send
#-DFRDBG_PRINT_SEND             在dbg日志里打印每秒发送的条数信息

#-DFRDBG_REPORT_ALL             显示所有数据(比如发包时间，ip地址等) 暂时没有该宏
#-DFRFRAME_CONVER_DOUBLE_DATE   上报数据中的日期(.d) -> long, 数字-> double

LIBS                = -lgthread-2.0 -luuid -lzlog -lzmq -ldl -ljson-c
LIBS                += $(LIBS_EXT) $(XML2LIB)

INCLUDES            = -I. -I$(LIB_I_APM_COMM) -I$(LIB_I_APM_MODULE) 

TARGET_LIB_LN       = report.so
ifdef DEFINE_NO_SEND
	TARGET_LIB_VER      = report_2.0_nosend.so
	LN                  = echo
else
	TARGET_LIB_VER      = report_2.0.so
	LN                  = ln -s
endif



SRC_LIB  = $(wildcard *.c)
OBJS_LIB = $(patsubst %.c, %.o, $(SRC_LIB))

all: $(TARGET_LIB_VER)

.c.o:$(OBJS_LIB)
	$(CX) -c $(CFLAGS) $(INCLUDES)  $<

$(TARGET_LIB_VER): $(OBJS_LIB) 
	$(CX) -shared -fPIC $(OBJS_LIB) $(LIB_A_APM_MODULE) $(LIB_A_APM_COMM) -o $@ $(INCLUDES) $(LIBS)

install:
	mkdir -p $(COMM_DIST_DIR_SO); 
	cp $(TARGET_LIB_VER) $(COMM_DIST_DIR_SO)/.; cd $(COMM_DIST_DIR_SO); rm -f $(TARGET_LIB_LN); $(LN) $(TARGET_LIB_VER) $(TARGET_LIB_LN)

uninstall:
	rm -f $(COMM_DIST_DIR_SO)/$(TARGET_LIB_VER); rm -f $(COMM_DIST_DIR_SO)/report*.so

clean:
	rm -f *.o $(TARGET_LIB_VER) *~ 

# EOF
